5.3.3 APPX Application Design Manual

+ Chapter 1-1: Overview of Application Design
+ Chapter 1-2: Getting Started
+ Chapter 1-3: Data Dictionary
+ Chapter 1-4: Understanding Process Design
+ Chapter 1-5: Interprocess Communication
+ Chapter 1-6: Customizing Your Application
+ Chapter 1-7: The Documentation Facility
+ Chapter 1-8: Application Design Tools
+ Chapter 2-1: Data Dictionary Overview
+ Chapter 2-2: Data Dictionary Concepts
+ Chapter 2-3: Domains
+ Chapter 2-4: Files and Fields
+ Chapter 2-5: Work Fields
+ Chapter 3-1: Overview of APPX Processes
+ Chapter 3-2: Getting Started
+ Chapter 3-3: Process Definition
+ Chapter 3-4: Menu Processes
+ Chapter 3-5: Job Processes
+ Chapter 3-6: Input Processes
+ Chapter 3-7: Output Processes
+ Chapter 3-8: Update Processes
+ Chapter 3-9: Query Processes
+ Chapter 3-10: Inquiry Processes
+ Chapter 3-11: Status Processes
+ Chapter 3-12: Subroutine Processes
+ Chapter 3-13: Table Processes
+ Chapter 3-14: Automatic and Optional Children
+ Chapter 3-15: Using the Image Editor
+ Chapter 3-16: Using GUI Features of the Image Editor
+ Chapter 3-17: Using Event Points
+ Chapter 4-1: ILF Integration
+ Chapter 4-2: True/False Status Indicators
+ Chapter 4-3: Specifying Statements
+ Chapter 4-4: The ILF Editor
+ Chapter 4-5: The Appx ILF Debugger
- Chapter 4-6: ILF Keyword Reference
+ Chapter 4-7: Predefined Fields
+ Chapter 4-8: Runtime Subroutine's and Predefined Processes
+ Chapter 4-9: Appx Chart Director API

Chapter 4-6: ILF Keyword Reference

READPREV (READP)


Read records in reverse order.

(1) T/F execution conditions
(2) Application ID
(3) File name or field name
(4) Hold type (0=do not hold, 1=hold, 2=hold with potential recovery)
(5) Fail Type (0=nothing, 1=warning, 2=error, 3=cancel)
(6) Access key field name

Normally, the READPREV statement sets the next status indicator to F or T depending on whether the beginning of the file is or is not reached, respectively.

If an BEG AT statement is executed before a READPREV, the status indicator is also set to F if the record read has a key value less than the one specified in the BEG AT statement. Note that the current record area contains the record that is beyond the BEG AT range.

If the READPREV sets the next status indicator to F, the FAIL or ( FT) parameter determines what additional action to take. In addition, on a false condition, the predefined field STATUS CODE returns a token indicating the reason for an I/O command failure. This token can be used as a key to read the system message file to obtain a descriptive I/O error message (see STATUS CODE for details).

Using the Statement

When using this statement in conjunction with an RDBMS table, you can specify a field name instead of a file name to limit the volume of data being passed between APPX and the RDBMS. See the Partial-Record I/O section in Specifying Statements for more information.

If a END ATstatement for this file is executed before the READPREV, the position in the file is modified before executing the READPREV, based on the value and relation specified in the END AT statement and the keypath identified by the READPREV statement.

The key path and position established by the process interpreter for the process control file has no effect on, and is not affected by, the READPREV position.

The READPREV statement allows a record to be read and held for update. While a record is held, no other user may update or delete that record. If the record is to be rewritten or deleted, the HOLD specification must be set to 1 (hold) or 2 (recover). Otherwise, it should be set to 0 (no). The recover specification holds the record and internally saves a copy of the record so that a subsequent rewrite or delete can be performed, even if the hold is lost (by reading another record with hold before completing the rewrite or delete). Recover can re-hold the record for update, as long as the saved copy is identical to the original record that was read. Note that performance is improved with hold type 1.

Note also that the READPREV statement does not generate an 'In Use' message if the record to be held is currently being held by another user. The READPREV statement waits until the record to be read is freed up by the other user, unless a TIMEOUT statement with a nonblank label was previously encountered. In that case, processing control transfers to the specified label.

Restrictions

The READPREV statement cannot be used with one-record or consecutive files.

Example

This example will read the 1EX VENDOR file starting at vendor 100, ending with vendor 1. Note that you define the BEG AT/END AT in the same way as you would for a READNEXT, the READPREV just determines the order in which the designated range of records will be returned.

Application Design Manual                                         "Powered by Appx Software"

1312

©2006 By APPX Software, Inc. All Rights Reserved